import { post } from "../service"

export interface LoginReq {
    account: string,
    pwd: string,
}

export interface User {
    id: number,
    name: string,
    account: string,
    pwd_enc: string,
}

export interface LoginRes {
    user: User,
    token: string,
}

export const login = async (req: LoginReq) => {
    return await post('/api/user/login', req) as LoginRes;
}

export interface CreateReq {
    name: string,
    account: string,
    pwd: string,
}

export interface CreateRes {
    id: number,
}

export const create = async (req: CreateReq) => {
    return await post('/api/user/create', req) as CreateRes;
}


